home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!newsmaster
- From: Mike Davies <100717.2065@compuserve.com>
- Newsgroups: comp.lang.c++
- Subject: Borland Turbo C++
- Date: Tue, 30 Jan 1996 22:32:16 -0800
- Organization: CompuServe Incorporated
- Message-ID: <310F0CF0.23E1@compuserve.com>
- NNTP-Posting-Host: dd79-010.compuserve.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (Win16; I)
-
- Help!
-
- I am running Borland Turbo C++ 3.1 for Windows and am having trouble with the following program.
- It compiles without error and runs to end, but does not have the desired effect of altering the
- text colour to red - all text is just printed in black.
-
- If anyone knows what the problem may be - please contact me as this has been driving me mad for a
- while now.
-
- Thanks in advance,
-
- Mike.
-
- Email: 100717.2065@compuserve.com
- or Mike_Davies@compuserve.com
-
- /********************************************************************************************/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <windows.h>
-
- void main(void)
- {
- HDC hdcIC;
- COLORREF colref;
-
- if((hdcIC = GetDC(NULL))==NULL)
- {
- strerror(errno);
- exit(1);
- }
-
- colref = GetTextColor(hdcIC);
- printf("\n\ncolref = %d (black)", colref);
-
- SetTextColor(hdcIC, RGB(255, 0, 0)); /* sets color to red */
-
- colref = GetTextColor(hdcIC);
- printf("\n\ncolref = %d (red)", colref);
-
- ReleaseDC(NULL, hdcIC);
-
- exit(0);
- }
-
- /*****************************************************************************************/
-